home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / powervww / pvinput.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-05  |  5.4 KB  |  204 lines

  1. //  ____________________________________________________
  2. // |                                                    |
  3. // |  Project:     POWER VIEW INTERFACE                 |
  4. // |  File:        PVINPUT.H                            |
  5. // |  Compiler:    WPP386 (10.6)                        |
  6. // |                                                    |
  7. // |  Subject:     Input box interface                  |
  8. // |                                                    |
  9. // |  Author:      Emil Dotchevski                      |
  10. // |____________________________________________________|
  11. //
  12. // E-mail: zajo@geocities.com
  13. // URL:    http://www.geocities.com/SiliconValley/Bay/3577
  14.  
  15. #ifndef _PVINPUT_H
  16. #define _PVINPUT_H
  17.  
  18. class Tinput_editor: public Tmemo
  19. {
  20. //<R> means read-only
  21. //<R/W> means read/write
  22.   public:
  23.     Tinput_editor( char *_line, int _max_len, int _xl );
  24.     virtual void scroll_to( int _x, int _y );
  25.  
  26.   protected:
  27.     virtual void get_focused( void );
  28. #ifndef HGR
  29.     virtual void set_palette( void );
  30. #endif
  31.     virtual void event_handler( Tevent &ev );
  32.     virtual void convert_event( Tevent &ev );
  33.     Ticon *left_icon;
  34.     Ticon *right_icon;
  35. };
  36.  
  37. class Tinput: public Tcombo_item
  38. {
  39.   public:
  40. #ifndef NOHIST
  41.     void *history_id;
  42. #endif
  43.     Tinput_editor *editor;
  44.     Tinput( char *_prompt, char *_line, int _max_length, int _xl );
  45. #ifndef NOHIST
  46.     Tinput( char *_prompt, char *_line, int _max_length, int _xl, Tlb_list *_hist );
  47. #endif
  48.     virtual void set_data( uint i );
  49.     virtual void get_data( char *s );
  50.     void set_txt( char *s );
  51.     void get_txt( char *s );
  52.  
  53.   protected:
  54.     virtual void draw( void );
  55.     virtual void get_focused( void );
  56.     virtual boolean release_focus( void );
  57.  
  58.   private:
  59.     void init( char *_line, int _max_length, int _xl );
  60. };
  61.  
  62. class Tlinput: public Tinput
  63. {
  64.   public:
  65.     Tlinput ( char *_prompt, long &_data, long _min, long _max );
  66. #ifndef NOHIST
  67.     Tlinput( char *_prompt, long &_data, long _min, long _max, Tlb_list *_hist );
  68. #endif
  69.     virtual boolean valid( uint stop_st );
  70.     void set_num( long n );
  71.     long get_num( void );
  72.  
  73.   private:
  74.     boolean hex;
  75.     long *data;
  76.     long min;
  77.     long max;
  78.     char lin[12];
  79.     char len;
  80.     char init_len( long _min, long _max );
  81.     void init( long &_data, long _min, long _max );
  82. };
  83.  
  84. class Tiinput: public Tlinput
  85. {
  86.   public:
  87.     Tiinput( char *_prompt, int &_data, int _min, int _max );
  88. #ifndef NOHIST
  89.     Tiinput( char *_prompt, int &_data, int _min, int _max, Tlb_list *_hist );
  90. #endif
  91.     virtual boolean valid( uint stop_st );
  92.  
  93.   private:
  94.     long tmp;
  95.     int *dta;
  96. };
  97.  
  98. class Tsinput: public Tlinput
  99. {
  100.   public:
  101.     Tsinput( char *_prompt, short &_data, short _min, short _max );
  102. #ifndef NOHIST
  103.     Tsinput( char *_prompt, short &_data, short _min, short _max, Tlb_list *_hist );
  104. #endif
  105.     virtual boolean valid( uint stop_st );
  106.  
  107.   private:
  108.     long tmp;
  109.     short *dta;
  110. };
  111.  
  112. class Twinput: public Tlinput
  113. {
  114.   public:
  115.     Twinput( char *_prompt, word &_data, word _min, word _max );
  116. #ifndef NOHIST
  117.     Twinput( char *_prompt, word &_data, word _min, word _max, Tlb_list *_hist );
  118. #endif
  119.     virtual boolean valid( uint stop_st );
  120.  
  121.   private:
  122.     long tmp;
  123.     word *dta;
  124. };
  125.  
  126. class Tcinput: public Tlinput
  127. {
  128.   public:
  129.     Tcinput( char *_prompt, char &_data, char _min, char _max );
  130. #ifndef NOHIST
  131.     Tcinput( char *_prompt, char &_data, char _min, char _max, Tlb_list *_hist );
  132. #endif
  133.     virtual boolean valid( uint stop_st );
  134.  
  135.   private:
  136.     long tmp;
  137.     char *dta;
  138. };
  139.  
  140. #ifndef NOFLOAT
  141. class Tdinput: public Tinput
  142. {
  143.   public:
  144.     Tdinput( char *_prompt, double &_data, double _min, double _max, char _decimals );
  145. #ifndef NOHIST
  146.     Tdinput( char *_prompt, double &_data, double _min, double _max, char _decimals, Tlb_list *_hist );
  147. #endif
  148.     virtual boolean valid( uint stop_st );
  149.     void set_num( double n );
  150.     double get_num( void );
  151.  
  152.   private:
  153.     double *data;
  154.     double min;
  155.     double max;
  156.     char lin[50];
  157.     char integer;
  158.     char decimals;
  159.     char len;
  160.     char init_len( double &data, double _min, double _max, char _decimals );
  161.     virtual void get_focused( void );
  162.     virtual boolean release_focus( void );
  163.     void init( void );
  164. };
  165.  
  166. class Tfinput: public Tdinput
  167. {
  168.   public:
  169.     Tfinput( char *_prompt, float &_data, float _min, float _max, char _decimals );
  170. #ifndef NOHIST
  171.     Tfinput( char *_prompt, float &_data, float _min, float _max, char _decimals, Tlb_list *_hist );
  172. #endif
  173.     virtual boolean valid( uint stop_st );
  174.  
  175.   private:
  176.     double tmp;
  177.     float *dta;
  178.     void init( void );
  179. };
  180. #endif //NOFLOAT
  181.  
  182. #endif
  183.  
  184. //PREFIXES
  185.  
  186. #ifndef NOHIST
  187. void *_history( void *history_id );  void *__history( void );
  188. #endif
  189. void _hexnum( void );                boolean __hexnum( void );
  190.  
  191. //CONSTRUCTORS FOR USE WITH DIALOG BOXES
  192.  
  193. Tinput *input( char *t, char *data, int len, int size );
  194. Tlinput *linput( char *t, long &data, long min, long max );
  195. Tiinput *iinput( char *t, int &data, int min, int max );
  196. Tsinput *sinput( char *t, short &data, short min, short max );
  197. Tcinput *cinput( char *t, char &data, char min, char max );
  198. Twinput *winput( char *t, word &data, word min, word max );
  199. #ifndef NOFLOAT
  200. Tdinput *dinput( char *t, double &data, double min, double max, char decimals );
  201. Tfinput *finput( char *t, float &data, float min, float max, char decimals );
  202. Tfinput *minput( char *t, float &data, float max );
  203. #endif
  204.